<?php


namespace app\home\controller;


use app\BaseController;
use app\Request;
use think\facade\Db;

class LendingHistory extends BaseController
{
    protected $middleware = [\app\middleware\Check2::class];

    public function index()
    {
        return view();
    }

    //    分页展示
    public function article(Request $request){

        //获取每页显示的条数
        $limit= $request->param('limit');
        //获取当前页数
        $page= $request->param('page');
        $list = Db::name('book_lending_history')
            ->alias('b')
            ->join('book c','b.book_id = c.id')
            ->paginate($limit,false,['page'=>$page])
            ->toArray();
        return json(['code'=>0,'msg'=>'','count'=>$list['total'],'data'=>$list['data']]);

    }
}